-
Notifications
You must be signed in to change notification settings - Fork 19
Add BLE support #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BLE support #28
Conversation
|
Your linter is not happy, but it doesn't say anything about what is wrong... |
46aaff9 to
9287e6b
Compare
Appears that it needs black formatting. You can run |
|
Wow, I didn't realize this could be so simple! Re: FW upgrades, if "image upload" is used, then the FW would not be expected to swap. To run a routine that swaps the FW, try "upgrade". |
|
lint locally wasn't any more helpful. Is there a verbose of fix option? My test was with "upgrade". |
You'll need to run black on the files that need to be formatted. May be helpful to enable debug logging, though some error should be indicated if the swap request is rejected. You can run image state-read to see if your upgrade is correctly in the secondary. |
|
I tried image state-read. Is this probably the old firmware? |
|
I should add --diff --color to the envr alias: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#diff |
9287e6b to
9caeb63
Compare
Likely! You can try image upload --slot 2, then read again and see what you see. |
|
Slot 2 not 1? |
|
Yes, black --diff is great and worth mentioning. |
|
I took the chance on slot 2 :) |
|
There are lots of (every packet) these warnings when uploading: |
References intercreate#12 Signed-off-by: Tormod Volden <[email protected]>
9caeb63 to
bef4c85
Compare
|
Are you happy with the command syntax? |
|
The upgrade gave no other warnings. |
|
I used upgrade --slot 2 and it worked! I am a happy camper! Seems like this is the only SMP over BLE command tool on Linux. I tried also AuTerm but it is a GUI with no possibilities of scripting. |
Yes, this is a whole mess! You can read about it here, it needs to be improved: #3
There are 2 parts to this:
For now, This will all be different in smpmgr 1.0.0. It's become clear that each transport should be its own subcommand group so that it can handle all the different arguments. The transport groups will be
Great! For scripting, I might recommend using smpclient directly - there are lots of examples scripts in that repo as HW integration tests. You can see example implementation in ESPHome here, for example: https://github.com/esphome/esphome/pull/6075/files#diff-493f483da80bddf50eae6653dda1843815a142b1b1912e4df0541aa3b7097439 For Linux shell scripting, maybe smpmgr is better. I'd recommend pipx over the portable though. Thanks for the contribution, I will test and merge ASAP. FYI: I've tested running parallel upgrades, even on multiple different transports, and this will definitely be a feature. E.g. it can be configured to scan for all BLE devices and upgrade them all in parallel, or upgrade all attached USB devices - good potential for factory tooling! No impact to speed of upgrade. BTW, what is your upload speed? We're expecting 10kB/s -> 25kB/s over BLE. I usually see about 15kB/s in Windows. |
|
Just noted that when I use --slot so it works, this is printed at the end: The speed I get is 40.9 kB/s according to the progress bar when it is done. |
That's wild. One thing that can cause it to report really fast uploads is if the image you're uploading is already on the device. When that happens, it sees that the SHA matches and doesn't do the upload. What chip are you testing? |
|
It is an nRF5340 and my laptop has a Intel Corp. AX201 Bluetooth module. I can test again with a clock and new image. |
Would be nice to have a release in pipx with BLE support soon :) |
Probably within a few days! I want to test it with HW. |
|
The firmware is 326700 bytes and the whole command (measured with "time") is e.g. 10.3 s so with the connection overhead removed I guess the transport is somewhere around 9 seconds. That would give 36 KB/s, or 32 KB/s included the whole invocation and connection overhead. But the reported speed from smpmgr is above 40 KB/s, also seen 44.4 KB/s once. |
OK, that seems to confirm the speeds. Hard for there to be a math error in the KB/s calculation. I gotta get a 53 dev kit. That BLE transfer is almost as fast as USB speeds on other boards, which makes me wonder how fast the USB transport upload is on that chip. The 52840 is the one where I tend to see 10-25 KB/s via BLE. |
|
OK, it's working for me on Windows + nrf 52840. I am connecting by using device name, e.g. I am going to push some other changes to main since I ended up needing longer timeouts (Windows BLE is ... not fun). Will tag you on release. |
|
@tormodvolden OK, should be on pipx now, LMK if there are any problems: https://pypi.org/project/smpmgr/ |
Wow! Thanks so much! |
Adds the --ble option which specifies the Bluetooth device address.
Seems to work somewhat, transfers to the device, but the expected flashing doesn't happen after reset.EDIT: Works fine when I specify the correct slot.